import request from '@/utils/request';

export async function query() {
  return request('/api/users');
}

// 获取当前用户登录信息
export async function queryCurrent() {
  return request('/admin/user');
}

// 获取商品列表
export async function getGoods(params) {
  return request('/admin/goods', { params });
}

// 上架和下架商品
export async function isOn(goodsId) {
  return request.patch(`/admin/goods/${goodsId}/on`);
}

// 推荐和不推荐商品
export async function isRecommend(goodsId) {
  return request.patch(`/admin/goods/${goodsId}/recommend`);
}

// 添加商品
export async function addGoods(params) {
  return request.post('/admin/goods', { params });
}

// 商品详情
export async function showGoods(editId) {
  return request(`/admin/goods/${editId}?include=category`);
}

// 编辑商品
export async function updateGoods(editId, params) {
  return request.put(`/admin/goods/${editId}`, { params });
}

// export async function queryNotices() {
//   return request('/api/notices');
// }
